package com.xq;

import com.xq.props.Props;

import java.util.HashMap;

/**
 * @description:
 * @author: 软妹倩哟
 * @date: Created in 2020/4/16 19:27
 * @version: v1.0
 * @modified By:
 */
public class Room {
    public String description;
    private Monster monster;
    private boolean withLiving = true;
    private Props props;
    private HashMap<String,Room> exits = new HashMap<String, Room>();

    public Room(String description, Monster monster, Props props)
    {
        this.description = description;
        this.monster = monster;
        this.props = props;
    }

    public void setExit(String dir,Room room){
        exits.put(dir,room);
    }

    public Props getProps() {
        return this.props;
    }

    public void cleanProps() {
        props = null;
    }
    @Override
    public String toString()
    {
        return description;
    }

    public String getExitDesc(){
        StringBuffer sb = new StringBuffer();
        for (String dir : exits.keySet() ) {
            sb.append(dir);
            sb.append(' ');
        }
        return sb.toString();
    }

    public Room getExit(String direction) {
        return exits.get(direction);
    }

    public Monster getMonster(){
        return monster;
    }
}
